Guard HMGET against empty payload keys in GetWorkflowInstanceHistory - #487
Merged
cschleiden merged 3 commits intoAug 10, 2026
Merged
Conversation
DerkSchooltink
force-pushed
the
fix/hmget-empty-payloads
branch
from
July 2, 2026 11:29
12c0521 to
acf11e1
Compare
Contributor
Author
|
Funnily enough this is already fixed in my Valkey PR: https://github.com/cschleiden/go-workflows/pull/460/changes#diff-33c2b06ea8a250f39db361963182b32d9f40e48dc055d65daa85e0e4597df261R103 @cschleiden let me know if you need more information, this is a bug I found in production, if you need specific logs or failure conditions, hit me up. :) |
When an instance's history stream is empty, payloadKeys is empty and HMGET is called with no fields, which Redis rejects with 'ERR wrong number of arguments for hmget'. Guard the payload fetch with len(payloadKeys) > 0, mirroring the existing guard in workflow.go.
DerkSchooltink
force-pushed
the
fix/hmget-empty-payloads
branch
from
July 2, 2026 11:44
acf11e1 to
a3737a8
Compare
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
cschleiden
approved these changes
Aug 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
(*redisBackend).GetWorkflowInstanceHistorycallsHMGET key <fields...>with an empty field list when an instance's history stream has no events, which Redis rejects:This surfaces as
reading payloads: ...fromGetWorkflowInstanceHistoryfor instances whose history stream is empty (e.g. an orphaned/pruned instance, or a read wherelastSequenceIDis at/after the newest event soXRANGEreturns nothing).Fix
getWorkflowInstanceStateinbackend/redis/workflow.goalready guards the identical payload fetch withif len(payloadKeys) > 0. This applies the same guard inbackend/redis/instance.go. When there are no events there are no payloads to fetch, so the block is simply skipped and an empty history is returned.